
//1446.连续字符
class Solution {
public:
    int maxPower(string s) {
        int n=s.size();
        int i=0,ret=0;
        while(i<n)
        {
            int start=i;  //记录当前位置
            while(i<n&&s[i]==s[start]) i++;  //判断该子字符串有多少个相同的字符

            ret=max(ret,i-start);  //更新答案
        }
        return ret;
    }
};